﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleData.ObjectModel;

namespace SimpleData.Storage.Common
{
	internal static class SqlServerConnectionHelper
	{
		private const int NoParameterName = -1;

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sql"></param>
		/// <param name="columnName"></param>
		/// <param name="index"></param>
		/// <param name="parameterName"></param>
		/// <returns></returns>

		internal static string ColumnNameWithTenant( this FieldName name )
		{
			throw new NotImplementedException();
			//return name.FullName;
		}

		//internal static string GetParameterName( this DataObjectColumn column )
		//{
		//    return column.GetParameterName( -1 );
		//}

		//internal static string GetParameterName( this DataObjectColumn column, int index )
		//{
		//    if ( index == NoParameterName )
		//        return "@p";
		//    else
		//        return String.Concat( "@p", index );
		//}

		internal static UpdateCommandBuilder CreateUpdateCommandBuilder( this DataObjectRow row )
		{
			var builder = new UpdateCommandBuilder();
			builder.IncludeColumnKey( row.Key );
			return builder;
		}
	}
	
}
